package com.san.hkhospital.service.impl;

import com.san.hkhospital.entity.Hospitalized;
import com.san.hkhospital.vo.Search2;
import com.san.hkhospital.vo.surdoTableVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.san.hkhospital.entity.SurDo;

import java.util.Date;
import java.util.List;
import com.san.hkhospital.mapper.SurDoMapper;
import com.san.hkhospital.entity.SurDoExample;
import com.san.hkhospital.service.SurDoService;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName:SurDoServiceImpl
 * PackageName:com.san.hkhospital.service.impl
 * Description:
 *
 * @Author:yy
 * @CreatedAt:2024/11/13 14:38
 * 
 */
 
 
@Service
@Transactional
public class SurDoServiceImpl implements SurDoService{

    @Resource
    private SurDoMapper surDoMapper;

    @Override
    public long countByExample(SurDoExample example) {
        return surDoMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(SurDoExample example) {
        return surDoMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer sdId) {
        return surDoMapper.deleteByPrimaryKey(sdId);
    }

    @Override
    public int insert(SurDo record) {
        return surDoMapper.insert(record);
    }

    @Override
    public int insertSelective(SurDo record) {
        return surDoMapper.insertSelective(record);
    }

    @Override
    public List<SurDo> selectByExample(SurDoExample example) {
        return surDoMapper.selectByExample(example);
    }

    @Override
    public SurDo selectByPrimaryKey(Integer sdId) {
        return surDoMapper.selectByPrimaryKey(sdId);
    }

    @Override
    public int updateByExampleSelective(SurDo record,SurDoExample example) {
        return surDoMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(SurDo record,SurDoExample example) {
        return surDoMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(SurDo record) {
        return surDoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SurDo record) {
        return surDoMapper.updateByPrimaryKey(record);
    }

    @Override
    public SurDo find(Integer id) {
        return surDoMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<surdoTableVO> findAll() {
        return surDoMapper.findAll();
    }

    @Override
    public boolean add(SurDo surDo) {
        int i = surDoMapper.insertSelective(surDo);
        return i>0?true:false;
    }

    @Override
    public boolean update(SurDo surDo) {
        int i = surDoMapper.updateByPrimaryKeySelective(surDo);
        return i>0?true:false;
    }

    @Override
    public List<surdoTableVO> search(Search2 search2) {
        return surDoMapper.search(search2);
    }

    @Override
    public boolean shoushuStart(Integer sdId) {
        SurDo surDo =new SurDo();
        surDo.setSdId(sdId);
        surDo.setSdStarttime(new Date());
        int i =surDoMapper.updateByPrimaryKeySelective(surDo);
        return i>0?true:false;
    }

    @Override
    public boolean shoushuEnd(Integer sdId) {
        SurDo surDo =new SurDo();
        surDo.setSdId(sdId);
        surDo.setSdEndtime(new Date());
        int i =surDoMapper.updateByPrimaryKeySelective(surDo);
        return i>0?true:false;

    }


}
